package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.system.mapper.AdminSongMapper;
import com.ruoyi.system.domain.AdminSong;
import com.ruoyi.system.service.IAdminSongService;
import com.ruoyi.common.core.text.Convert;

/**
 * 曲目Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-06-16
 */
@Service
public class AdminSongServiceImpl implements IAdminSongService 
{
    @Autowired
    private AdminSongMapper adminSongMapper;

    /**
     * 查询曲目
     * 
     * @param songId 曲目ID
     * @return 曲目
     */
    @Override
    public AdminSong selectAdminSongById(Long songId)
    {
        return adminSongMapper.selectAdminSongById(songId);
    }

    /**
     * 查询曲目列表
     * 
     * @param adminSong 曲目
     * @return 曲目
     */
    @Override
    public List<AdminSong> selectAdminSongList(AdminSong adminSong)
    {
        return adminSongMapper.selectAdminSongList(adminSong);
    }

    /**
     * 新增曲目
     * 
     * @param adminSong 曲目
     * @return 结果
     */
    @Override
    public int insertAdminSong(AdminSong adminSong)
    {
        adminSong.setCreateTime(DateUtils.getNowDate());
        return adminSongMapper.insertAdminSong(adminSong);
    }

    /**
     * 修改曲目
     * 
     * @param adminSong 曲目
     * @return 结果
     */
    @Override
    public int updateAdminSong(AdminSong adminSong)
    {
        adminSong.setUpdateTime(DateUtils.getNowDate());
        return adminSongMapper.updateAdminSong(adminSong);
    }

    /**
     * 删除曲目对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdminSongByIds(String ids)
    {
        return adminSongMapper.deleteAdminSongByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除曲目信息
     * 
     * @param songId 曲目ID
     * @return 结果
     */
    @Override
    public int deleteAdminSongById(Long songId)
    {
        return adminSongMapper.deleteAdminSongById(songId);
    }
    
    /**
     * 曲目状态修改
     * 
     * @param song 曲目信息
     * @return 结果
     */
    @Override
    public int changeStatus(AdminSong adminSong)
    {
        return adminSongMapper.updateAdminSong(adminSong);
    }
}
